﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FactoryDeviceSystem.Controls
{
    public partial class UDevice : UserControl
    {
        public UDevice()
        {
            InitializeComponent();
        }

        private bool state = false;

        public bool State
        {
            get { return state; }
            set 
            { 
                state = value;
            }
        }

        public int DeviceNo { get; set; }

        private string deviceName = "101设备";

        public string DeviceName
        {
            get { return deviceName; }
            set 
            {
                deviceName = value;
                label1.Text = deviceName;
            }
        }

        public bool CanOpen
        {
            get { return openBtn.Enabled; }
            set
            {
                openBtn.Enabled = value;
            }
        }

        public bool CanClose
        {
            get { return closeBtn.Enabled; }
            set
            {
                closeBtn.Enabled = value;
            }
        }

        public event EventHandler StartEvent;
        public event EventHandler StopEvent;

        private void button1_Click(object sender, EventArgs e)
        {
            StartEvent?.Invoke(this, e);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            StopEvent?.Invoke(this, e);
        }
    }
}
